<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>服务申请审核 - 宠物邻里互助平台</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary: #FFF9C4;
            --primary-dark: #FFECB3;
            --secondary: #FFFDE7;
            --accent: #FFD54F;
            --text: #5D4037;
            --text-light: #8D6E63;
            --success: #81C784;
            --warning: #FFB74D;
            --danger: #E57373;
            --border: rgba(255, 213, 79, 0.3);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
        }

        body {
            background-color: var(--secondary);
            color: var(--text);
            display: flex;
            min-height: 100vh;
        }

        /* 侧边导航 */
        .sidebar {
            width: 240px;
            background: var(--primary);
            padding: 20px 0;
            box-shadow: 2px 0 10px rgba(0,0,0,0.05);
            transition: all 0.3s ease;
            z-index: 100;
        }

        .logo {
            padding: 0 20px 20px;
            border-bottom: 1px solid var(--border);
            margin-bottom: 20px;
            text-align: center;
        }

        .logo h1 {
            font-size: 22px;
            color: var(--text);
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .logo i {
            margin-right: 10px;
            color: var(--accent);
        }

        .nav-item {
            padding: 12px 25px;
            margin: 5px 10px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            cursor: pointer;
            transition: all 0.2s;
            color: var(--text-light);
            font-weight: 500;
        }

        .nav-item:hover, .nav-item.active {
            background: var(--primary-dark);
            color: var(--text);
        }

        .nav-item i {
            width: 24px;
            margin-right: 12px;
            font-size: 18px;
        }

        .sub-nav {
            padding-left: 55px;
            margin-top: 5px;
            display: none;
        }

        .sub-nav.active {
            display: block;
        }

        .sub-nav-item {
            padding: 8px 0;
            color: var(--text-light);
            font-size: 14px;
            display: flex;
            align-items: center;
        }

        .sub-nav-item i {
            font-size: 12px;
            margin-right: 8px;
        }

        .sub-nav-item:hover, .sub-nav-item.active {
            color: var(--text);
            font-weight: 500;
        }

        /* 主内容区 */
        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
        }

        /* 顶部栏 */
        .topbar {
            background: white;
            padding: 15px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            z-index: 10;
        }

        .search-bar {
            display: flex;
            align-items: center;
            background: var(--secondary);
            border-radius: 24px;
            padding: 8px 15px;
            width: 300px;
        }

        .search-bar input {
            border: none;
            background: transparent;
            padding: 5px 10px;
            width: 100%;
            color: var(--text);
            outline: none;
        }

        .search-bar i {
            color: var(--text-light);
        }

        .user-info {
            display: flex;
            align-items: center;
        }

        .user-info img {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            object-fit: cover;
            margin-right: 10px;
            border: 2px solid var(--primary);
        }

        /* 内容区 */
        .content {
            padding: 25px;
            flex: 1;
            overflow-y: auto;
        }

        .section-title {
            font-size: 22px;
            margin-bottom: 25px;
            display: flex;
            align-items: center;
        }

        .section-title i {
            margin-right: 12px;
            color: var(--accent);
        }

        /* 申请卡片样式 */
        .application-list {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
            gap: 20px;
        }

        .application-card {
            background: white;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
            transition: transform 0.3s, box-shadow 0.3s;
        }

        .application-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 20px rgba(0,0,0,0.08);
        }

        .application-card h3 {
            color: var(--text);
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--border);
        }

        .application-card p {
            margin-bottom: 10px;
            color: var(--text-light);
        }

        .status-pending {
            color: var(--warning);
            font-weight: 500;
            padding: 4px 10px;
            background: rgba(255, 183, 77, 0.2);
            border-radius: 20px;
            font-size: 14px;
        }

        .btn-review {
            display: inline-block;
            background: var(--accent);
            color: var(--text);
            padding: 8px 15px;
            border-radius: 8px;
            text-decoration: none;
            font-weight: 500;
            margin-top: 10px;
            transition: all 0.2s;
        }

        .btn-review:hover {
            background: #FFC107;
            text-decoration: none;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .sidebar {
                width: 70px;
            }

            .logo h1 span, .nav-item span {
                display: none;
            }

            .logo h1 {
                justify-content: center;
            }

            .nav-item {
                justify-content: center;
                padding: 15px;
            }

            .nav-item i {
                margin-right: 0;
                font-size: 20px;
            }

            .search-bar {
                width: 200px;
            }

            .application-list {
                grid-template-columns: 1fr;
            }
        }

        .logout-btn {
            padding: 8px 12px;
            margin-left: 15px;
            background: rgba(229, 115, 115, 0.1);
            color: var(--danger);
            border-radius: 6px;
            text-decoration: none;
            font-size: 14px;
            display: flex;
            align-items: center;
            transition: all 0.2s;
            border: 1px solid rgba(229, 115, 115, 0.3);
        }

        .logout-btn i {
            margin-right: 6px;
            font-size: 13px;
        }

        .logout-btn:hover {
            background: rgba(229, 115, 115, 0.2);
            color: var(--danger);
        }
    </style>
</head>
<body>
<!-- 侧边导航 -->
<div class="sidebar">
    <div class="logo">
        <h1><i class="fas fa-paw"></i> <span>宠物邻里互助平台</span></h1>
        <p style="font-size: 13px; color: var(--text-light); margin-top: 5px;">管理后台</p>
    </div>
    <div class="nav-item active">
        <i class="fas fa-file-alt"></i>
        <span><a href="${pageContext.request.contextPath}/application/list">申请管理</a></span>
    </div>
    <div class="nav-menu">


        <div class="nav-item">
            <i class="fas fa-users"></i>
            <span><a href="${pageContext.request.contextPath}/user/list">用户管理</a></span>
        </div>

        <div class="nav-item">
            <i class="fas fa-home"></i>
            <span>寄养管理</span>
            <i class="fas fa-chevron-down" style="margin-left: auto;"></i>
        </div>
        <div class="sub-nav">
            <div class="sub-nav-item">
                <i class="fas fa-circle"></i>
                <span><a href="${pageContext.request.contextPath}/Admin/hostList">寄养家庭管理</a></span>
            </div>
            <div class="sub-nav-item">
                <i class="fas fa-circle"></i>
                <span><a href="${pageContext.request.contextPath}/Admin/orderList">寄养订单管理</a></span>
            </div>
        </div>


    </div>
</div>

<!-- 主内容区 -->
<div class="main-content">
    <!-- 顶部操作栏 -->
    <div class="topbar">
        <div class="search-bar">
            <i class="fas fa-search"></i>
            <input type="text" placeholder="搜索...">
        </div>

        <div class="user-info">
            <i class="fas fa-bell" style="font-size: 18px; margin-right: 20px; color: var(--text-light);"></i>
            <img src="https://randomuser.me/api/portraits/women/43.jpg" alt="管理员">
            <span>张管理员</span>
            <a href="${pageContext.request.contextPath}/user/logout" class="logout-btn">
                <i class="fas fa-sign-out-alt"></i> 退出
            </a>
        </div>
    </div>

    <!-- 内容区 -->
    <div class="content">
        <h1 class="section-title"><i class="fas fa-tasks"></i> 待审核服务申请</h1>

        <div class="application-list">
            <c:forEach items="${applications}" var="app">
                <div class="application-card">
                    <h3>申请ID: ${app.application_id}</h3>
                    <p><i class="fas fa-user"></i> 用户ID: ${app.user_id}</p>
                    <p><i class="fas fa-tag"></i> 申请类型: ${app.application_type}</p>
                    <p><i class="fas fa-clock"></i> 提交时间: ${app.submitted_at}</p>
                    <p><i class="fas fa-info-circle"></i> 状态: <span class="status-pending">${app.status}</span></p>
                    <a href="${pageContext.request.contextPath}/application/${app.application_id}" class="btn-review">
                        <i class="fas fa-edit"></i> 审核
                    </a>
                </div>
            </c:forEach>
        </div>
    </div>
</div>

<script>
    // 导航菜单交互
    const navItems = document.querySelectorAll('.nav-item');

    navItems.forEach(item => {
        // 点击导航项
        item.addEventListener('click', function() {
            // 移除所有活动项
            navItems.forEach(nav => nav.classList.remove('active'));

            // 设置当前项为活动状态
            this.classList.add('active');

            // 切换子菜单显示
            const subNav = this.nextElementSibling;
            if (subNav && subNav.classList.contains('sub-nav')) {
                subNav.classList.toggle('active');
            }
        });

        // 子菜单项点击
        const subNavItems = item.nextElementSibling?.querySelectorAll('.sub-nav-item');
        if (subNavItems) {
            subNavItems.forEach(subItem => {
                subItem.addEventListener('click', function(e) {
                    e.stopPropagation();
                    subNavItems.forEach(i => i.classList.remove('active'));
                    this.classList.add('active');
                });
            });
        }
    });
</script>
</body>
</html>